package com.only4play.practice.common.enums.pay;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.only4play.codegen.support.constants.BaseEnum;

import java.util.Optional;

/**
 * @author mdy
 */
public enum MerchantNotifyType implements BaseEnum<MerchantNotifyType> {
    /** http */
    HTTP(1,"http"),
    /** websocket */
    WEBSOCKET(2,"websocket"),
    /** mq */
    MQ(3,"mq"),
    /** 不启用 */
    NONE(4,"none");



    MerchantNotifyType(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    @EnumValue
    private Integer code;
    private String name;

    @Override
    public Integer getCode() {
        return this.code;
    }

    @Override
    public String getName() {
        return this.name;
    }

    public static Optional<MerchantNotifyType> of(Integer code) {
        return Optional.ofNullable(BaseEnum.parseByCode(MerchantNotifyType.class, code));
    }
}
